package edu.polsl.bio.str.manager.dao;

import edu.polsl.bio.str.common.entity.Chromosome;
import edu.polsl.bio.str.common.entity.Individual;
import org.hibernate.criterion.DetachedCriteria;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import java.util.List;

/**
 * //todo class description
 * <p/>
 * Created on: Jun 14, 2011 1:00:19 PM <br/>
 * <a href="http://www.polsl.pl">www.polsl.pl</a>
 *
 * @author lukasz.olczak@polsl.pl
 */
public class IndividualDaoImpl extends HibernateDaoSupport implements IndividualDao {
  /**
   * slf4j Logger.
   */
  private static final Logger log = LoggerFactory.getLogger(IndividualDaoImpl.class.getName());

  @Override
  public List<Individual> getAllIndividuals() {
    DetachedCriteria query = DetachedCriteria.forClass(Chromosome.class);
    return getHibernateTemplate().findByCriteria(query);
  }

  @Override
  public Individual getById(Long id) {
    return (Individual) getHibernateTemplate().get(Individual.class, id);
  }
}
